package com.example.mybatisplusdemo.model.dto;

import lombok.Data;

@Data
public class PaymentResponseDTO {
        private boolean success; // 是否成功
        private String message; // 返回消息
        private String paymentNo; // 支付流水号
        private String payUrl; // 支付URL(用于跳转支付)
        private String qrCode;

        public static PaymentResponseDTO success(String message, String paymentNo, String payUrl) {
                PaymentResponseDTO response = new PaymentResponseDTO();
                response.setSuccess(true);
                response.setMessage(message);
                response.setPaymentNo(paymentNo);
                response.setPayUrl(payUrl);
                return response;
        }

        // 失败静态方法
        public static PaymentResponseDTO fail(String message) {
                PaymentResponseDTO response = new PaymentResponseDTO();
                response.setSuccess(false);
                response.setMessage(message);
                return response;
        }

        // 带支付二维码的成功方法
        public static PaymentResponseDTO successWithQrCode(String message, String paymentNo, String qrCode) {
                PaymentResponseDTO response = new PaymentResponseDTO();
                response.setSuccess(true);
                response.setMessage(message);
                response.setPaymentNo(paymentNo);
                response.setQrCode(qrCode);
                return response;
        }
}
